<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

Route::prefix('sms')->group(function () {
    Route::post('send',[\App\Http\Controllers\Auth\SmsController::class,'sendCode']); //发送验证码
    Route::post('test',[\App\Http\Controllers\Auth\SmsController::class,'test']); //发送验证码
    Route::post('sendSmsRecharge',[\App\Http\Controllers\Auth\SmsController::class,'sendSmsRecharge']); //发送验证码
});

Route::prefix('logon')->group(function () {
    Route::post('login',[\App\Http\Controllers\Auth\UserController::class,'loginBySms']); //登录
    Route::post('refreshToken',[\App\Http\Controllers\Auth\UserController::class,'refresh']); //刷新token
});

Route::post('alipaySync', [\App\Http\Controllers\Alipay\AlipayController::class, 'alipaySync']); //支付宝同步回调地址
Route::post('alipayNotify', [\App\Http\Controllers\Alipay\AlipayController::class, 'alipayNotify']);// 支付宝异步回调地址
Route::middleware('auth:interface')->post('createh5Pay', [\App\Http\Controllers\Alipay\AlipayController::class, 'createh5Pay']);// 支付宝创创建支付
Route::any('createwebPay', [\App\Http\Controllers\Alipay\AlipayController::class, 'createwebPay']);// 支付宝创创建网页支付

Route::prefix('order')->group(function () {
    Route::post('createOrder',[\App\Http\Controllers\Alipay\AlipayController::class,'testOrder']); //测试下单
});
//商户回调
Route::any('/notify/{en}', function (Request $request, string $en) {
    return \App\Recharge\Logic\ApiNotifyLogic::new($request, $en)->send();
});
Route::post('testOrder',[\App\Http\Controllers\Alipay\AlipayController::class,'testOrder']); //内部下单
Route::prefix('order')->group(function () {
    Route::post('create_order',[\App\Http\Controllers\InternalApi\Request_orderController::class,'create_order']); //内部下单
    Route::post('H5_goods_list',[\App\Http\Controllers\InternalApi\Request_orderController::class,'H5_goods_list']); //活动商品展示
    Route::post('H5_order_48_error',[\App\Http\Controllers\InternalApi\Request_orderController::class,'H5_order_48_error']); //活动页面查询订单
    Route::post('h5_is_phone_card',[\App\Http\Controllers\InternalApi\Request_orderController::class,'h5_is_phone_card']); //活动页面检测订单
});
Route::post('merchantOrder',[\App\Http\Controllers\Supplier\Order::class,'merchantOrder']); //商户订单未税
